<!DOCTYPE html>
<script src=../../resources/run-after-layout-and-paint.js></script>
<script>
if (window.testRunner)
  testRunner.waitUntilDone();

function insertSVGImage() {
    var image = document.createElementNS('http://www.w3.org/2000/svg', 'image');
    image.setAttribute('width', 192);
    image.setAttribute('height', 64);
    image.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'resources/rgb.svg');
    image.onload = function() {
      runAfterLayoutAndPaint(function() {
        if (window.testRunner)
          testRunner.notifyDone();
      });
    };
    document.querySelector('g').appendChild(image);
}

function startTest() {
  runAfterLayoutAndPaint(insertSVGImage);
}
</script>
<svg width="384" height="128" style="display: block">
  <g transform="scale(2)"></g>
</svg>
<div>
  <img src="resources/rgb.svg" onload="startTest()" style="width: 384px; height: 128px;">
</div>
